package com.hf.work04;

public class MyUnit {
    public static double getDoubleValue(Double de){
        if (de == null){
            return 0.0;
        }else{
            return de;
        }
    }

    public static void stuArray(){
        //创建Student数组，并定义长度为5
        Student[] students = new Student[5];
        //数组赋值
        students[0] = new ComputerDepartment(2050413221, "任小盼", "女", 21, Math.random()*100, Math.random()*100, Math.random()*100, Math.random()*100);
        students[1] = new EnglishDepartment(2050413222, "李刚", "男", 22, Math.random()*100, Math.random()*100, Math.random()*100);
        students[2] = new LetterDepartment(2050413223, "邱宇", "女", 21, Math.random()*100, Math.random()*100, Math.random()*100, Math.random()*100);
        students[3] = new ComputerDepartment(2050413224, "万一", "男", 20, Math.random()*100, Math.random()*100, Math.random()*100, Math.random()*100);
        students[4] = new ComputerDepartment(2050413225, "规范", "女", 21, Math.random()*100, Math.random()*100, Math.random()*100, Math.random()*100);
        //遍历数组
        for (Student i : students){
            System.out.println("学号："+i.getStuNo()+"，姓名:"+i.getStuName()+"，性别:"+i.getStuSex()+"，年龄:"+i.getStuAge()+"，综合成绩:"+String.format("%.2f",i.sumScore()));

        }

    }



}
